// Tomboy - A simple and easy to use note-taking application.
//
// Copyright (C) 2004-2007 Alex Graveley <alex@beatniksoftware.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
//
// Authors:
//	Everaldo Canuto <everaldo.canuto@gmail.com>

using System;
using Gtk;
using Hildon;
using Mono.Unix;

namespace Tomboy
{
	public class Tomboy
	{
		private static NoteManager manager;
		
		public static void Main (string[] args)
		{
			Osso.Context.Initialize ("tomboy", "1.0");

			Catalog.Init ("tomboy", Defines.GNOME_LOCALE_DIR);
			
			Application.Init ("Tomboy", ref args);

			InitializeNoteManager ();

			Program program = Program.Instance;
			program.AddWindow (CreateStartWindow ());

			Application.Run ();

			Osso.Context.Deinitialize ();
		}
		
		private static void InitializeNoteManager ()
		{
			// Create the default note manager instance.
			string note_path = String.Format ("{0}/.tomboy", Environment.GetEnvironmentVariable ("HOME"));
			manager = new NoteManager (note_path);
		}
		
		private static Hildon.Window CreateStartWindow  ()
		{
			Note note = manager.FindByUri (NoteManager.StartNoteUri);
			
			return new NoteWindow (note);
		}
		
		//public static NoteManager NoteManager {
		//	get { return manager; }
		//}
		
		// To prevent NoteManager compilation error.
		public static event EventHandler ExitingEvent;
		
	}
}
